import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common';
import { CardService } from './card.service';
import { RequireLogin, UserInfo } from 'src/common/decorator';
import { GetListDto } from './dto/get-list.dto';

@Controller('card')
@RequireLogin()
export class CardController {
  constructor(private readonly cardService: CardService) {}

  @Post(':key')
  useKey(@Param('key') key: string, @UserInfo('userId') userId: string) {
    return this.cardService.useKey(key, userId);
  }

  @Get('check/:key')
  check(@Param('key') key: string, @UserInfo('userId') userId: string) {
    return this.cardService.check(key, userId);
  }

  @Get('list')
  getList(@Body() getListDto: GetListDto) {
    return this.cardService.getList(getListDto);
  }
}
